package testdemo.controller;

import edu.nf.beans.annotations.Component;
import edu.nf.beans.annotations.Inject;
import edu.nf.web.ActionContext;
import edu.nf.web.annotation.RequestMapping;
import testdemo.dao.NoticeDao;
import testdemo.dto.ValueDto;
import testdemo.model.Notice;
import testdemo.service.NoticeService;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class NoticeContoller implements  NoticeService {
    @Inject(name="noticeDao")
    private NoticeDao noticeDao;

    @RequestMapping("/getAllnotice")
    public List<Map<String, Object>> getAllnotice() {
        List<Map<String, Object>> allnotice = noticeDao.getAllnotice();
        return noticeDao.getAllnotice();
    }

    @RequestMapping("/NoticeActionDelete")
    public void deleteNotice(int id) {
        id = Integer.parseInt("id");
        noticeDao.deleteNotice(id);

    }

    @RequestMapping("/NoticeActionUpdateShow")
    public void updateNotice(int id) {
        id = Integer.parseInt("id");
        noticeDao.updateNotice(id);
    }

    @RequestMapping("/NoticeActionAdd")
    public void addNotice(Integer id, String title, String content, Date time) {
     id = Integer.parseInt("id");
     noticeDao.addNotice(id, title, content, time);
    }
}
